package day04.Homework;
import java.util.Scanner;
public class Standard_Homework {
    public static void main(String[] args) {
        //语言基础第四天标准练习：-----最少2遍

        /* 1.  CommandBySwitch命令解析程序：
            要求：接收用户输入的命令，依据命令做不同的操作
        */
        //第一遍:
        /*
        Package day04;
        import java.util.Scanner;
        public class CommandBySwitch {
            public static void main(String[] args) {
                Scannar scan = new Scanner(System.in);
                System.out.println("请选择功能: 1.取款 2.存款 3.查询余额 0.退卡");
                int command = scan.nextInt*();

                switch(command) {
                    case 1:
                        System.out.println("取款操作...");
                        break;
                    case 2:
                        System.out.println("存款操作...");
                        break;
                    case 3:
                        System.out.println("查询余额操作...");
                        break;
                    case 0:
                        System.out.println("退出成功");
                        break;
                    default:
                        System.out.println("输入错误");
                }
            }
        }
         */

        //第二遍:
        /*
        package day04;
        import java.util.Scanner;

        public class CommandBySwitch {
            public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                System.out.println("请选择功能: 1.取款 2.存款 3.查询余额 0.退卡");
                int command = scan.nextInt();

                switch(command) {
                    case 1:
                        System.out.println("取款操作...");
                        break;
                    case 2:
                        System.out.println("存款操作...");
                        break;
                    case 3:
                        System.out.println("查询余额操作");
                        break;
                    case 0:
                        System.out.println("退出成功");
                        break;
                    default:
                        System.out.println("输入错误");
                }
            }
        }
         */

        //第三遍:
        /*
        package day04;
        import java.util.Scanner;

        public class CommandBySwitch {
            public static vod main(String[] args) {
                Scanner scan = new Scanner(System.in);
                System.out.println("请选择功能: 1.取款 2.存款 3.查询余额 0.退卡");
                int command = scan.nextInt();

                switch(command) {
                    case 1:
                        System.out.println("取款操作...");
                        break;
                    case 2:
                        System.out.println("存款操作...");
                        break;
                    case 3:
                        System.out.println("查询余额操作...");
                        break;
                    case 0:
                        System.out.println("退出成功");
                        break;
                    default:
                        System.ourt.println("输入错误");
                }
            }
        }
         */

         //第四遍:
        /*
        package day 04;
        import java.util.Scanner;

        pubic class CommandBySwitch {
            public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                System.out.println("请选择功能: 1.取款 2.存款 3.查询余额 0.退卡");
                int command = scan.nextInt();

                switch(command) {
                    case 1:
                        System.out.println("取款操作...");
                        break;
                    case 2:
                        System.out.println("存款操作...");
                        break;
                    case 3:
                        System.out.println("查询余额操作...");
                        break;
                    case 0:
                        System.out.println("退出成功");
                        break;
                    default:
                        System.out.println("输入错误");
                }
            }
        }
         */

        /*
        2. Guessing猜数字之while版：随机生成一个数，由用户来猜，猜不对则反复猜，并给出大小提示，
            猜对的则结束，用while来实现。
         */
        //第一遍:
        /*
        package day04;
        import java.util.Scanner;

        public class Guessing {
            public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                int num = (int) (Math.random() * 1000 +1);
                System.out.println(num);

                System.out.println("猜吧!");
                int guess = scan.nextInt();
                while (guess != num) {
                    if (guess > num) {
                        System.out.println("太大了");
                    } else {
                        System.out.println("太小了");
                    }
                    System.out.println("猜吧!");
                    guess = scan.nextInt();
                }
                System.out.println("恭喜你猜对了!");
            }
        }
         */

        //第二遍:
        /*
        package day04;
        import java.util.Scanner;

        public class Guessing {
            public static vod main(String[] args) {
                Scanner scan = new Scanner(System.in);
                int num = (int)(Math.random() * 1000 + 1);
                System.out.println(num);

                System.out.println("猜吧!");
                int guess = scan.nextInt();
                while (guess != num) {
                    if (guess > num) {
                        System.out.println("太大了");
                    } else {
                        System.out.println("太小了");
                    }
                }
                System.out.println("猜吧!");
                guess = scan.nextInt();
            }
            System.out.println("恭喜你猜对了!");
        }
         */

        //第三遍:
        /*
        package day04;
        import java.util.Scanner;

        public class Guessing {
            public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                int num = (int) (Math.random() * 1000 + 1);
                System.out.println(num);

                System.out.println("猜吧!");
                int guess = scan.nextInt();
                while (guess != num) {
                    if (guess > num) {
                        System.out.println("太大了");
                    } else {
                        System.out.println("太小了");
                    }
                    System.out.println("猜吧!");
                    guess = scan.nextInt();
                }
                System.out.println("恭喜你猜对了!");
            }
        }
         */

        //第四遍:
        /*
        package day04;
        import java.util.Scanner;

        public class Guessing {
            public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                int num = (int) (Math.random() * 1000 + 1);
                System.out.println(num);

                System.out.println("猜吧!");
                int guess = scan.nextInt();
                while(guess != num) {
                    if(guess > num) {
                        System.out.println("太好了");
                    } else {
                        System.out.println("太小了");
                    }
                    System.out.println("猜吧!");
                    guess = scan.nextInt();
                }
                System.out.println("恭喜你猜对了!")
            }
        }
         */

        /*
        3. Guessing猜数字之do...while版：随机生成一个数，由用户来猜，猜不对则反复猜，并给出大小提
            示，猜对的则结束，用do...while来实现。
         */
        //第一遍:
        /*
        package day04;
        import java.util.Scanner;

        public class Guessing {
            public static void main (String[] args) {
                Scanner scan = new Scanner(System.in);
                int num = (int) (Math.random() * 1000 + 1);
                System.out.println(num);

                int guess;
                do {
                    System.out.println("猜吧!");
                    guess = scan.nextInt();
                    if (guess > num) {
                        System.out.println("太大了");
                    } else if (guess < num) {
                        System.out.println("太小了");
                    } else {
                        System.out.println("恭喜你猜对了");
                    }
                } while (guess != num);
            }
        }
         */

        //第二遍:
        /*
        package day04;
        import java.util.Scanner;

        public class Guessing {
            public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                int num = (int) (Math.random() * 1000 + 1);
                System.out.println(num);

                int guess;
                do {
                    System.out.println("猜吧!");
                    guess = scan.nextInt();
                    if(guess > num) {
                        System.out.println("太大了");
                    } else if (gess < num) {
                        System.out.println("太小了");
                    } else {
                        System.out.println("恭喜你猜对了");
                    }
                } while (guess != num);
            }
        }
         */

        //第三遍:
        /*
        package day04;
        import java.util.Scanner;

        publc class Guessing {
            public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                int num = (int) (Math.random() * 1000 + 1);
                System.out.println(num);

                int guess;
                do {
                    System.out.println("猜吧!");]
                    guess = scan.nextInt();
                    if (guess > num) {
                        System.out.println("太大了");
                    } else if (guess < num) {
                        System.out.println("太小了");
                    } else {
                        System.out.println("恭喜你猜对了");
                    }
                } while (guess != num);
            }
        }
         */

        //第四遍:
        /*
        package day04;
        import java.util.Scanner;

        public class Guessing {
            public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                int num = (int) (Math.random() * 1000 + 1);
                System.out.println(num);

                int guess;
                do {
                    System.out.println("猜吧!");
                    guess = scan.nextInt();
                    if (guess > num) {
                        System.out.println("太大了");
                    } else if (guess < num) {
                        System.out.println("太小了");
                    } else{
                        System.out.println("恭喜你猜对了");
                    }
                } while (guess != num);
            }
        }
         */
    }
}
